package com.vitanov.multiimagepicker;

import io.flutter.plugin.common.MethodChannel;

public class ResultHandler {

  final MethodChannel.Result result;

  private boolean isReply = false;

  public ResultHandler(MethodChannel.Result result) {
    this.result = result;
  }

  void reply(Object object) {
    if (isReply) {
      return;
    }
    isReply = true;
    result.success(object);
  }

  void replyError(String code, String msg) {
    if (isReply) {
      return;
    }
    isReply = true;
    result.error(code, msg, "");
  }
}
